<template>
    <el-breadcrumb>
        <el-breadcrumb-item :to="{ path: 'home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>课程分类</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="item">
        <el-badge :value="teditlist.length" class="item">
            <el-button>发布记录</el-button>
        </el-badge>
        <el-scrollbar height="300px">
            <div v-for="(item, i) in teditlist" :key="i" class="scrollbar-demo-item"
                :class="{ important: item.type == 2 }">
                <div class="edititem">{{ item.title }}</div>
                <div class="edititem">{{ item.create_time.slice(0, 16) }} </div>
            </div>
        </el-scrollbar>
    </div>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import { gettedit } from '@/apis/edit';
// @ts-ignore
import { Userstore } from '@/stores/user.js';
const teditlist = ref<any>([])
const getteditlist = async () => {
    const res = await gettedit({teacherid:userstore.userinfo.teacherid})
    teditlist.value = res.data.data.reverse()
    console.log(teditlist.value);

}
onMounted(() => {
    getteditlist()
})
const userstore = Userstore()
</script>
<style lang='scss' scoped>
.el-breadcrumb {
    margin-bottom: 10px;
}
.scrollbar-demo-item {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 50px;
  margin: 10px;
  text-align: center;
  border-radius: 4px;
  background: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
}
.important {
    color: red;
}
.edititem {
    width: 50%;
    height: 100%;
    line-height: 40px;
    text-align: center;
}</style>